package com.sdhs.myproject.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sdhs.common.utils.spring.SpringUtils;
import com.sdhs.myproject.domain.ProjectManageCost;
import com.sdhs.myproject.mapper.ProjectManageCostMapper;
import com.sdhs.myproject.service.IProjectManageCostService;
import org.springframework.stereotype.Service;

@Service
public class ProjectManageCostServiceImpl extends ServiceImpl<ProjectManageCostMapper, ProjectManageCost> implements IProjectManageCostService {

	/**
	 * 根据项目id查询项目管理费用明细
	 * @param projectId
	 * @return
	 */
	public ProjectManageCost getByProjectId(Long projectId) {
		LambdaQueryWrapper<ProjectManageCost> lqw = new LambdaQueryWrapper<ProjectManageCost>()
				.eq(ProjectManageCost::getProjectId, projectId);
		ProjectManageCost projectManageCost = this.getOne(lqw);
		return projectManageCost;
	}

	/**
	 * 根据项目商机id和主办类型查询项目管理费用明细
	 * @param isOrganization,businessId
	 * @return
	 */
    public ProjectManageCost findByBusinessIdAndOrganization(String businessId, String isOrganization) {
		LambdaQueryWrapper<ProjectManageCost> lqw = new LambdaQueryWrapper<ProjectManageCost>()
				.eq(ProjectManageCost::getBusinessId, businessId)
                .eq(ProjectManageCost::getIsOrganization, isOrganization);
        return this.getOne(lqw);
    }
}
